import deviceApi from "../../../api/deviceInfo";
import {toast} from "../../../utils/util";
import storage from '../../../utils/storage';
Page({
  data: {
    pageSize: 10,
    pageNum: 1,
    status: 'more',
    type: 1,
    items: {},
    groupItems: {},
    name: ''
  },
  onLoad: function (options) {
    
  },
  click () {
    wx.navigateTo({
      url: '/pages/mine/chooseGroup/index',
    })
  },
  deviceList () {
    wx.navigateTo({
      url: '/pages/mine/deviceList/index',
    })
  },
  submit() {
    let params = {
      deviceId: this.data.items.id,
      groupId: this.data.groupItems.id,
      onLine: this.data.items.onLine,
      name: this.data.name
    }
    deviceApi.addDevice(params).then(res => {
      toast("绑定成功");
      wx.navigateBack()
    })
  },
  changeTap (e) {
    this.setData({
      name: e.detail.value
    })
  },
});